﻿namespace NumericalData.Systems
open System
open System.Collections
open System.Collections.Generic
open System.Diagnostics
open System.Threading
open NumericalData
open NumericalData.Exceptions  
open NumericalData.Attributes

[<AbstractClass>]
type BaseAnswer = 
    class
        val m_vec:Vector

        new(vec:Vector) = 
            {
                m_vec = vec
            }

        member x.AnswerVector
            with get() = x.m_vec
    end 

///// {=========================Answer=========================}
type Answer = 
        class
            inherit BaseAnswer
            ///-----------------------------Fields-----------------------------
            val m_iterations:int
            val m_accuracy:double
            val m_mistake:double
                
            ///-----------------------------Constructors-----------------------------
            new(vec:Vector,iters:int,mistake:double,accur:double) = 
                {
                    inherit BaseAnswer(vec)
                    m_iterations = iters;
                    m_mistake = mistake
                    m_accuracy = accur
                }
            internal new(ans:Answer) = 
                {
                    inherit BaseAnswer(ans.AnswerVector)
                    m_iterations = ans.IterationsNumber;
                    m_mistake = ans.Mistake
                    m_accuracy = ans.Accuracy
                }    

            ///-----------------------------Properties-----------------------------
            [<PropertyAnalysisWorkName("Number Of Iterations")>]
            member x.IterationsNumber 
                with get() = x.m_iterations

            member x.Accuracy
                with get() = x.m_accuracy

            [<PropertyAnalysisWorkName("Mistake")>]
            member x.Mistake
                with get() = x.m_mistake

            ///-----------------------------Operators-----------------------------
            ///-----------------------------Methods-----------------------------
            ///-----------------------------InterfaceImplementation------------------
        end
    and 
    ///// {=========================ClassName=========================}
    DiagnosticsAnswer = 
        class
            inherit Answer
            ///-----------------------------Fields-----------------------------
            val m_elapsedTime:double
            val m_memoryUsage:int64
            ///-----------------------------Constructors-----------------------------
            new (ans:Answer,elapsed:TimeSpan, memUsage:int64) =
                {
                    inherit Answer(ans)
                    m_elapsedTime = elapsed.TotalMilliseconds
                    m_memoryUsage = memUsage
                } 
            ///-----------------------------Properties-----------------------------
            [<PropertyAnalysisWorkName("Memory Usage")>]
            member x.MemoryUsage
                with get() = x.m_memoryUsage

            [<PropertyAnalysisWorkName("Elapsed Milliseconds")>]
            member x.ElapsedTime
                with get() = x.m_elapsedTime
            ///-----------------------------Operators-----------------------------
            ///-----------------------------Methods-----------------------------
            ///-----------------------------InterfaceImplementation------------------
        end